package com.wkhyapp.lm.adapter;

import android.view.View;
import android.widget.RelativeLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wkhyapp.lm.R;
import com.wkhyapp.lm.http.vo.Category;
import com.wkhyapp.lm.http.vo.Fans;

import java.util.List;

/**
 * Created by fang on 2021/10/24.
 */

public class UserCategoryAdapter extends BaseQuickAdapter<Category, BaseViewHolder> {

    public UserCategoryAdapter.callBack mCallBack;

    public UserCategoryAdapter(int layoutResId, List<Category> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, final Category item) {

        helper.setText(R.id.name_tv,item.getName()+"");
//        helper.setText(R.id.nums_tv,item.getNums()+"件");
        RelativeLayout category_rl = helper.getView(R.id.category_rl);

        category_rl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mCallBack.action(item);
            }
        });
    }

    public void  setCallBack(UserCategoryAdapter.callBack callBack){
        this.mCallBack = callBack;
    }


    public interface  callBack{
        void action(Category item);
    }
}
